import request from '@/utils/axios';
import qs from 'qs';
export async function fetch(params) {
  return request({
    url: '/api/users/read/page',
    params
  });
}

export async function create(params) {
  return request({
    url: '/api/users',
    method: 'post',
    data: params
  });
}

export async function update(params) {
  return request({
    url: `/api/users`,
    method: 'put',
    data: params
  });
}

export async function remove(params) {
  return request({
    url: '/api/users',
    data: params,
    method: 'delete'
  });
}

export async function fetchRoles() {
  return request({
    url: '/api/roles/all'
  });
}

export async function auth(params) {
  return request({
    url: 'api/auths/allot',
    method: 'post',
    data:params
  });
}

export async function judgeExist(params) {
  return request({
    url: `api/users/exist`,
    params
  });
}

export function sendMessage(params) {
  return request({
    url: 'socket/api',
    method: 'post',
    data: params
  });
}
